From f1c76c01609bfd35fe6d83da90d7105ae2e8269a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 2 Jun 2011 18:46:33 +0100 Subject: [PATCH] libxl: make libxl_ctx_free tolerate NULL ctx argument This is purely for convenience (eg, when debugging). Signed-off-by: Ian Jackson Committed-by: Ian Jackson --- tools/libxl/libxl.c | 1 + tools/libxl/libxl.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 344eec3cdf..f45dd39f06 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -85,6 +85,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger * lg) int libxl_ctx_free(libxl_ctx *ctx) { + if (!ctx) return 0; if (ctx->xch) xc_interface_close(ctx->xch); libxl_version_info_destroy(&ctx->version_info); if (ctx->xsh) xs_daemon_close(ctx->xsh); diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 1f37adc2e1..b0471c0654 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -232,7 +232,7 @@ typedef struct { /* context functions */ int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger *lg); -int libxl_ctx_free(libxl_ctx *ctx); +int libxl_ctx_free(libxl_ctx *ctx /* 0 is OK */); int libxl_ctx_postfork(libxl_ctx *ctx); /* domain related functions */ -- 2.30.2